<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/4/6 0006
 * Time: 17:11
 */
namespace app\modules\content\models;

use yii\db\ActiveRecord;

class ClassesSdk extends ActiveRecord
{
    public static function tableName()
    {
        return '{{%classes_sdk}}';
    }

    public function rules()
    {
        return [
            // username and password are both required
            // [['student', 'cate', '', 'duration'], 'required'],

        ];
    }

    /**
     * [actionGetSdk description]
     * @Author don
     * @Date   2021-11-03
     * @param  [type]     $id [description]
     * @return [type]         [description]
     */
    public static function getSdk($id)
    {
        $data = self::find()->where(['classesId'=>$id])->asArray()->all();
        if ($data) {
            // $sdk = array_column($data, 'sdk');
            // return implode(',', $sdk);
            return $data;
        } 
        return '';
    }

    /**
     * [getClassSdk description]
     * @Author don
     * @Date   2021-11-03
     * @param  [type]     $id [description]
     * @return [type]         [description]
     */
    public static function getClassSdk($id)
    {
        $data = self::find()->where(['classesId'=>$id])->orderBy('sort asc')->asArray()->all();

        if ($data) {
            return $data;
        }
        return null;
    }
}